{% extends 'bootstrap/base.html' %}

{% block title %}Flasky{% endblock %}

{% block navbar %}
<div class="navbar navbar-inverse" role="navigation">
	<div class="container">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
			</button>
			<a href="/" class="navbar-brand">Flasky</a>
		</div>
		<div class="navbar-collapse collapse">			
			{% if user %}
			<ul class="nav navbar-nav">
				{% if user.role == '教师' %}				
				<li><a href="/u/{{ user.id }}">首页</a></li>
				{% elif user.role == '学生' %}
				<li><a href="/s/{{ user.id }}">首页</a></li>
				{% endif %}
			</ul>
			<ul class="nav navbar-nav navbar-right">
		        <li><a href="/u/{{ user.id }}/account">账户信息</a></li>
		        <li><a href="/download/flasky.apk">下载app</a></li>
		        <li><a href="/logout">退出</a></li>
		    </ul>
		    {% else %}
		    <ul class="nav navbar-nav">
				<li><a href="/">首页</a></li>
			</ul>
		    <ul class="nav navbar-nav navbar-right">
		        <li><a href="/signup">注册</a></li>
		        <li><a href="/forget">忘记密码</a></li>
		        <li><a href="/download/flasky.apk">下载app</a></li>
		    </ul>
		    {% endif %}
		</div>
	</div>
</div>
{% endblock %}

{% block content %}
	<div class="container">
	{% for message in get_flashed_messages() %}
		<div class="alert alert-info">
			<button type="button" class="close" data-dismiss="alert">&times;</button>
			{{ message }}
		</div>
	{% endfor %}

	{% block page_content %}{% endblock %}
	</div>
{% endblock %}

